<style>
    /* 遮罩样式 */
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #ffffff;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999; /* 确保遮罩在最顶层 */
    }

    /* 加载提示样式 */
    .loading-text {
        color: white;
        font-size: 24px;
    }
</style>
<!-- 加载遮罩 -->
<div class="overlay">
    <div class="loading-text">Loading...</div>
</div>

<script>
    // 获取 header 元素
    var headerElement = document.querySelector('header');
    let time = setInterval(function (){
        if(headerElement){
            clearInterval(time)
            // 如果找到了 header 元素，则移除它
            if (headerElement) {
                headerElement.parentNode.removeChild(headerElement);
            }

            // 在class下添加元素
            // 获取 .wp-site-blocks 下的第一个 main 元素
            var wpSiteBlocks = document.querySelector('.wp-site-blocks');
            wpSiteBlocks.style.padding = 0
            // 遍历 .wp-site-blocks 的子节点
            var children = wpSiteBlocks.children;
            for (var i = 0; i < children.length; i++) {
                var child = children[i];
                // 如果子节点既不是 <main> 也不是 <footer>，则移除它
                if (child.tagName.toLowerCase() !== 'main' && child.tagName.toLowerCase() !== 'footer') {
                    wpSiteBlocks.removeChild(child);
                }
            }

            let wpSiteMainBlocks = document.querySelector('.wp-site-blocks > main');
            wpSiteMainBlocks.innerHTML = ''
            wpSiteMainBlocks.style.padding = 0

            // 获取屏幕高度
            var screenHeight = window.innerHeight || document.documentElement.clientHeight;
            // 创建一个 iframe 元素
            let iframe = document.createElement('iframe');
            // 设置 iframe 的属性
            iframe.setAttribute('width', '100%');
            iframe.setAttribute('height', (screenHeight - 50) + 'px');
            iframe.setAttribute('id', 'mi_publica');
            iframe.setAttribute('src', 'https://mipublica.woo.maojimall.com/#/design/write_index');
            wpSiteMainBlocks.appendChild(iframe)
        }
        console.log('header:', headerElement)
    },500)

</script>
